﻿using HandyControl.Controls;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using WcsZz.Extend;
using wms_wpf.Apiservice;
using wms_wpf.InPut;

namespace wms_wpf.DialogView
{
    /// <summary>
    /// Dialog7.xaml 的交互逻辑
    /// </summary>
    public partial class Dialog7 : UserControl
    {
        public Dialog7()
        {
            InitializeComponent();

            service=new UserService();
        }

        private readonly MyUserService service;

        private async void UpdatePassWord_Click(object sender, RoutedEventArgs e)
        {
            InPut_UserService InPut=new InPut_UserService();
            InPut.Moniker = Moniker.Text;
            InPut.Email=Email.Text;
            InPut.Phone=PhoneNumber.Text;
            InPut.Name=UserName.Text;
            InPut.Role = Combobox.Text;
            InPut.PassWord = PassWord.Password;
            bool Nullres = InPut.GetType().GetProperties().All(property => !string.IsNullOrEmpty (property.GetValue(InPut).ToString()));
            if (!Nullres) { Growl.Info("请填写完整", "msg"); return; }
            bool result=  await service.RegisterUser(InPut);
            if (result) EventAggregatorHelper.EventAggregator.SendMessage("", "GetList_View_User");
        }
    }
}
